minios: Various small fixes.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 19 Mar 2007 09:34:42 +0000 (09:34 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 19 Mar 2007 09:34:42 +0000 (09:34 +0000)
- Fixed type of variables in hypervisor.c.
- Fixed not removing a waiter from watch_queue.
- Make wait_for_watch() global accessible.

Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
extras/mini-os/hypervisor.c
extras/mini-os/include/wait.h
extras/mini-os/include/xenbus.h
extras/mini-os/xenbus/xenbus.c

index 2c2efa7e4647b749c0396e6b9b5a479925cecf97..ed87845195163a66a9c7a1bb11d4a45b4859ceec 100644 (file)
@@ -35,8 +35,8 @@
 
 void do_hypervisor_callback(struct pt_regs *regs)
 {
-    u32               l1, l2;
-    unsigned int   l1i, l2i, port;
+    unsigned long  l1, l2, l1i, l2i;
+    unsigned int   port;
     int            cpu = 0;
     shared_info_t *s = HYPERVISOR_shared_info;
     vcpu_info_t   *vcpu_info = &s->vcpu_info[cpu];
index f581db9109a36b263ae81f8a622596d41810c4e6..d8338fbd8e2359cffdc3aee8e9d67fc593511c64 100644 (file)
@@ -74,6 +74,13 @@ static inline void wake_up(struct wait_queue_head *head)
     local_irq_restore(flags);   \
 } while (0)
 
+#define remove_waiter(w) do {   \
+    unsigned long flags;        \
+    local_irq_save(flags);      \
+    remove_wait_queue(&w);      \
+    local_irq_restore(flags);   \
+} while (0)
+
 #define wait_event(wq, condition) do{             \
     unsigned long flags;                          \
     if(condition)                                 \
index 3866a8bbce1dbf3ce101a0d0b5119f9c24a36490..cd4e85d122fba67115aba598d8cdc9a2c8740c54 100644 (file)
@@ -13,6 +13,7 @@ void init_xenbus(void);
 char *xenbus_read(xenbus_transaction_t xbt, const char *path, char **value);
 
 char *xenbus_watch_path(xenbus_transaction_t xbt, const char *path);
+void wait_for_watch(void);
 char* xenbus_wait_for_value(const char*,const char*);
 
 /* Associates a value with a path.  Returns a malloc'd error string on
index f4832119478052a587ae6859d70c6409a718477a..9433b22b0276bf564c42281e6c453fa5de2149fd 100644 (file)
@@ -72,11 +72,12 @@ static void memcpy_from_ring(const void *Ring,
     memcpy(dest + c1, ring, c2);
 }
 
-static inline void wait_for_watch(void)
+void wait_for_watch(void)
 {
     DEFINE_WAIT(w);
     add_waiter(w,watch_queue);
     schedule();
+    remove_waiter(w);
     wake(current);
 }